﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using WmsApp.Style;

namespace WmsApp.Window
{
    /// <summary>
    /// 同时提供实际库存+预入库+预出库的库存查询
    /// </summary>
    public partial class FormStoreQuery : BaseForm
    {
        public FormStoreQuery()
        {
            InitializeComponent();
            if (GlobalClass.RunTimeMode)
            {
                this.xtraTabPage2.PageVisible = false;
            }
        }

        public override string HeadText
        {
            get { return "库存查询管理"; }
        }

        private void CmdQuery_Click(object sender, EventArgs e)
        {
            this.gridControlMain .DataSource = Factory.WmsServiceFactory.GetServiceClient().GetExtendStoreGoodsListByCondition(this.qStoreGoods1.GetCondition());
            //RowStyleConditionController.AddStyleFormatCondition(this.gridView0, "StoreGoodsStateDesc", "[StoreGoodsStateDesc]='库存警告'",Color.Yellow);
            RowStyleConditionController.AddStyleFormatCondition(this.gridView0, "StoreGoodsStateDesc", "[StoreGoodsStateDesc]='低于安全库存'", Color.Red);
            RowStyleConditionController.AddStyleFormatCondition(this.gridView0, "StoreGoodsStateDesc", "[StoreGoodsStateDesc]='高于最大库存'", Color.Yellow);
        }

        private void CmdPreviewQuery_Click(object sender, EventArgs e)
        {
            this.gridControlVPreviewStoreGoods.DataSource = Factory.WmsServiceFactory.GetServiceClient().GetVPreviewStoreGoodsListByCondition(this.qStoreGoodsPrepare1.GetCondition());
            //RowStyleConditionController.AddStyleFormatCondition(this.gridView1, "StoreGoodsStateDesc", "[StoreGoodsStateDesc]='库存警告'", Color.Yellow);
            RowStyleConditionController.AddStyleFormatCondition(this.gridView1, "StoreGoodsStateDesc", "[StoreGoodsStateDesc]='低于安全库存'", Color.Red);
            RowStyleConditionController.AddStyleFormatCondition(this.gridView0, "StoreGoodsStateDesc", "[StoreGoodsStateDesc]='高于最大库存'", Color.Yellow);
        }
    }
}